package com.cci.kangdao.dao;

import com.cci.kangdao.dao.model.CustomerEngineRelLoadMsgRelationT;
import com.cci.kangdao.dao.model.FuelTripRecordT;
import com.cci.kangdao.model.CurrentFaultsInfo;
import com.cci.kangdao.model.FuelBehaviorRecommedInfo;
import com.cci.kangdao.model.FuelTripRecordInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;
import java.util.Map;


@MapperScan
public interface CustomerEngineRelLoadMsgRelationTDao {


	int insertSelective(Map<String, Object> map);

	CustomerEngineRelLoadMsgRelationT selectById(@Param("id") Long id);


	@Select("select top 1 * from CustomerEngineRelLoadMsgRelation_T where CustomerEngineRelId  = #{customerEngineRelId} and Flag = 0\n" +
			"order by CreateTime desc")
	Map<String, Object> getNewestLoadMsgByCustomerEngineRelId(@Param("customerEngineRelId") Long customerEngineRelId);

	List<CustomerEngineRelLoadMsgRelationT> getListByCusEngineIdAnduserId(@Param("userId") long id, @Param("customerEngineRelId") Long customerEngineRelId);

	int getIsRecommend(@Param("userId") long id, @Param("customerEngineRelId") Long customerEngineRelId);


	CustomerEngineRelLoadMsgRelationT getIsRecommendClass(@Param("userId") long id, @Param("customerEngineRelId") Long customerEngineRelId);

	int updateByPrimaryKeySelective(CustomerEngineRelLoadMsgRelationT customerEngineRelLoadMsgRelationT);

	int updateLoadMsgComments(Map<String, Object> map);

	//油耗导航行程数据记录表
	int insertFuelTrip(FuelTripRecordT fuelTripRecordT);

	//油耗导航行程数据记录表
	int updateFuelTrip(FuelTripRecordT fuelTripRecordT);
	//更新本条数据
	int updateFuelTripById(FuelTripRecordT fuelTripRecordT);

	FuelTripRecordInfo getFuelTripRecordByLoadMsgId(@Param("loadMsgId") Long loadMsgId);

	//同步油耗驾驶行为建议信息
	FuelBehaviorRecommedInfo getFuelTripRecommedByLoadMsgId(@Param("loadMsgId") Long loadMsgId);

	//现行故障
	List<CurrentFaultsInfo> getCurrentFaultsbyEsn(@Param("esn") String esn,@Param("startTime") String startTime);

	List<CustomerEngineRelLoadMsgRelationT> getLoadMsgSearch(Map<String, Object> map);

	List<Map<String,Object>> getLoadMsgHistory(Map<String, Object> map);
}
